/*
 * s_opendoor_ctl.h
 *
 *  Created on: Nov 21, 2019
 *      Author: hemingway
 */

#ifndef USER_DOOROPENCONTROL_S_OPENDOOR_CTL_H_
#define USER_DOOROPENCONTROL_S_OPENDOOR_CTL_H_

typedef enum
{
    s_opendoor_ok = 0,
    s_opendoor_addr_notmatch,
    s_opendoor_data_illegal
}s_opendoor_status;

extern s_opendoor_status S_OpenDoor_Data_Init(void);
extern s_opendoor_status S_OpenDoor_CompareSpecialBLEAddr(const unsigned char *addr);
extern s_opendoor_status S_OpenDoor_RecordDevIndex(unsigned char index);
extern unsigned char S_OpenDoor_GetDevIndex(void);

extern s_opendoor_status S_OpenDoor_RecordConnHdl(unsigned short hdl);
extern unsigned short S_OpenDoor_GetConnHdl(void);

extern s_opendoor_status S_OpenDoor_RecordCharHdl(unsigned short hdl);
extern unsigned short S_OpenDoor_GetNotiyHdl(void);
extern unsigned short S_OpenDoor_GetWriteHdl(void);

extern s_opendoor_status S_OpenDoor_BLETurnOnNotifySuccessHandle(void);
extern s_opendoor_status S_OpenDoor_BLEWriteSuccessHandle(void);
extern s_opendoor_status S_OpenDoor_BLEGetNotifyHandle(const unsigned char *data, unsigned short length);

extern s_opendoor_status S_OpenDoor_SendCheckSignedData(unsigned char *data, unsigned short length);

extern unsigned char *S_OpenDoor_SendCheckSignedData_Point(void);
extern unsigned short S_OpenDoor_SendCheckSignedData_Length(void);

extern s_opendoor_status S_OpenDoor_Updata_MAC(\
							const unsigned char *mac);
extern s_opendoor_status S_OpenDoor_Updata_MACType(\
							unsigned char type);

extern unsigned char *S_OpenDoor_Get_MAC(void);
extern unsigned char S_OpenDoor_Get_MACType(void);

extern s_opendoor_status S_OpenDoor_Connect_Search(void);
#endif /* USER_DOOROPENCONTROL_S_OPENDOOR_CTL_H_ */
